1
'***************************** Module Header ******************************\
2 '* Module Name: ImagePreviewControl.cs
3 '* Project: VBASPNETImagePreviewExtender
4 '* Copyright (c) Microsoft Corporation
6 '* The project illustrates how to design an AJAX Control Extender.
7 '* In this sample, it is extender for images.
8 '* The images which use the extender control will show in a thumbnail mode at
9 '* first, if user click the image, a big image will pop up and show the true
12 '* This source is subject to the Microsoft Public License.
13 '* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
14 '* All other rights reserved.
16 '\****************************************************************************
18 <TargetControlType(GetType(Control
))> _
19 Public Class ImagePreviewControl
20 Inherits ExtenderControl
23 ''' Define the css class which the image use in thumbnail mode.
25 Public Property ThumbnailCssClass() As String
27 Return m_ThumbnailCssClass
29 Set(ByVal value
As String)
30 m_ThumbnailCssClass
= value
33 Private m_ThumbnailCssClass
As String
36 ''' return the resource url of the close icon.
38 Private ReadOnly
Property closeImage() As String
40 Return Page
.ClientScript
.GetWebResourceUrl(Me.[GetType
](), "ImagePreviewExtender.Close.png")
44 Protected Overrides
Function GetScriptDescriptors(ByVal targetControl
As System
.Web
.UI
.Control
) As IEnumerable(Of ScriptDescriptor
)
45 Dim descriptor
As New ScriptBehaviorDescriptor("ImagePreviewExtender.ImagePreviewBehavior", targetControl
.ClientID
)
46 descriptor
.AddProperty("ThumbnailCssClass", ThumbnailCssClass
)
48 descriptor
.AddProperty("closeImage", closeImage
)
49 Return New List(Of ScriptDescriptor
) From
{descriptor
}
52 ' Generate the script reference
53 Protected Overrides
Function GetScriptReferences() As IEnumerable(Of ScriptReference
)
54 Dim scriptRef
As New ScriptReference("ImagePreviewExtender.ImagePreviewBehavior.js", Me.GetType().Assembly
.FullName
)
56 Return New List(Of ScriptReference
) From
{scriptRef
}